import requests

url = "http://n.sinaimg.cn/news/crawl/117/w550h367/20220417/a3a9-08b2ca6dffe4210149dda424adf0734f.jpg"

# 1.发送请求获取图片资源
resp = requests.get(url)

# 2. 创建文件并写出
fw = open("feiji.jpg", "wb")
fw.write(resp.content)
